const { DataTypes } = require("sequelize");

module.exports = (sequelize) => {
  const attributes = {
    s_id: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: null,
      primaryKey: true,
      autoIncrement: true,
      comment: null,
      field: "s_id",
    },
    s_name: {
      type: DataTypes.STRING(5),
      allowNull: false,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: null,
      field: "s_name",
    },
    s_sex: {
      type: DataTypes.STRING(2),
      allowNull: false,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: null,
      field: "s_sex",
    },
    s_date: {
      type: DataTypes.DATE,
      allowNull: true,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: null,
      field: "s_date",
    },
    s_phone: {
      type: DataTypes.STRING(16),
      allowNull: false,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: null,
      field: "s_phone",
    },
    s_cid: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: null,
      field: "s_cid",
    },
    s_age: {
      type: DataTypes.STRING(4),
      allowNull: false,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: null,
      field: "s_age",
    },
    s_grade: {
      type: DataTypes.STRING(7),
      allowNull: false,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: null,
      field: "s_grade",
    },
  };
  const options = {
    tableName: "t_student",
    comment: "",
    indexes: [
      {
        name: "c_id",
        unique: false,
        type: "BTREE",
        fields: ["s_cid"],
      },
    ],
  };
  const TStudentModel = sequelize.define(
    "t_student_model",
    attributes,
    options
  );
  return TStudentModel;
};
